﻿class SPConsole:
    "The class responsible for writing to the output window"
    def write(self, text):
        if (text <> None):
            rtTxt.Text += text.ToString()
        
    def writeln(self, text):
        if (text <> None):
            self.write(text.ToString()+"\n")

    def writeDict(self, dict):
        if (dict <> None):
            for f in dict:
                self.writeln(f.Key.ToString()+":"+f.Value.ToString())

    def writeDict2(self, dict):
        if (dict <> None):
            for f in dict:
                self.writeln(f.ToString())

    def writeCol(self,coll, prop):
        for obj in coll:
            eval("self.writeln(obj."+prop+")")
            
    def writeCol2(self,col, prop):
        for obj in col:
            eval("self.writeln(obj['"+prop+"'])")

out = SPConsole()
import sys
sys.stdout = out

class SPCoderLog:
    "The class responsible for writing to the Log window"
    def log(self, text):
        spLog.LogInfo (text.ToString());
    
    def logInfo(self, text):
        spLog.LogInfo (text.ToString());

    def logError(self, text):
        spLog.LogError (text.ToString());
    
    def logWarning(self, text):
        spLog.LogWarning (text.ToString());

logger = SPCoderLog()

class SPReflector:
    "The helper class responsible for autocomplete"
    def members(self, obj):
        a = obj.__class__.__dict__
        l = []
        for i in a.Keys:
            l.append(i)
        for i in obj.__dict__.Keys:
            l.append(i)                    
        return l
        
reflect = SPReflector()